package com.rybbaby.tss.front.tssPayment.service.imp;

import com.rybbaby.tss.core.web.service.imp.BaseServiceImp;
import com.rybbaby.tss.front.tssPayment.dao.ITssPaymentDao;
import com.rybbaby.tss.front.tssPayment.entity.TssPayment;
import com.rybbaby.tss.front.tssPayment.service.ITssPaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @description 缴费表数据库操作服务实现
 * 
 * @author 雷春琼
 * 
 * @createDate 2017-08-10 上午12:22:55
 */
@Service
@Transactional
public class TssPaymentServiceImp extends BaseServiceImp<TssPayment> implements ITssPaymentService {

    @Autowired
    private ITssPaymentDao paymentDao;

    @Override
    public List<TssPayment> findDepositById(String id) throws Exception{
        return paymentDao.findDepositById(id);
    }

    @Override
    public int updateDepositIds(String[] strs,String memberPackageId,String contractNumber) {
        String ids = "";
        for(int i=0,len=strs.length;i<strs.length;i++){
            if(i == 0){
                ids = ids + "'" + strs[i] +"'";
            }else{
                ids = ids + "," +"'"+ strs[i] + "'";
            }
        }
        return paymentDao.updateDepositIds(ids,memberPackageId,contractNumber);
    }

    @Override
    public List<TssPayment> findApplyStatus(String memberId) throws Exception{
        return paymentDao.findApplyStatus(memberId);
    }

    @Override
    public Map<String, Object> findTodayPayment(String adminUserIds) {
        return paymentDao.findTodayPayment(adminUserIds);
    }

    @Override
    public Map<String, Object> findMonthPayment(String adminUserIds) {
        return paymentDao.findMonthPayment(adminUserIds);
    }

    @Override
    public Serializable saveEntity(TssPayment entity) {
        return paymentDao.save(entity);
    }

    @Override
    public Map<String, Object> findContractNumber(String contractNumber) {
        return paymentDao.findContractNumber(contractNumber);
    }
}


